#include "stdio.h"
#include "string.h"

int main(){
    int N=0,M=0;
    scanf("%d%d",&N,&M);
    int arr[N];
    for (int i = 0; i < N; ++i) {
        scanf("%d",&arr[i]);
    }
    for (int i = 0; i < M; ++i) {
        int temp = arr[N-1];
        for (int i=N-1;i>0;i--){
            arr[i] = arr[i-1];
        }
        arr[0] = temp;
    }
    for (int i = 0; i < N - 1; ++i) {
        printf("%d ",arr[i]);
    }
    printf("%d\n",arr[N-1]);
    return 0;
}